package com.bosicloud.cmb.ibp.account.api;


import com.bosicloud.cmb.ibp.account.common.constant.UrlDefine;
import com.bosicloud.cmb.ibp.account.common.dto.LoginParamDTO;
import com.bosicloud.cmb.ibp.account.common.model.IbpUser;
import com.bosicloud.cmb.ibp.account.common.model.IbpUserApiKey;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "AccountManagerService", url = "${ibp.service.account-url}")
public interface AccountManagerClient {

    @PostMapping(UrlDefine.ACC_LOGIN)
    IbpUser login(@RequestBody LoginParamDTO loginParamDTO);

    @PostMapping(value = UrlDefine.CREATE_USER_API_KEY)
    Integer createUserApiKey(@RequestBody IbpUserApiKey ibpUserApiKey);


    @GetMapping(value = UrlDefine.SEARCH_USER_API_KEY + "/users/{userId}")
    List<IbpUserApiKey> searchUserApiKeyListByUserId(@PathVariable(name = "userId", value = "userId") Integer userId);

}
